package com.sys.business.custom.custominfo.webservice;

import java.net.MalformedURLException;

import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;

import com.portal.framework.dao.ParameterCatch;
import com.sys.business.custom.custominfo.dto.CustomInfoDTO;
		
public class CustomerDataService {

	public static CustomerWebService getSrvc(){
		String webUrl="http://192.168.70.31/servicesys/services/CustomInfoWebService";
//		String webUrl=ParameterCatch.parameterMap.get("sysDataService")+"/CustomInfoWebService";
		CustomerWebService srvc=null;
		Service srvcModel = new ObjectServiceFactory().create(CustomerWebService.class);
		XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());
		try{
		srvc=(CustomerWebService) factory.create(srvcModel,webUrl);
		}catch(MalformedURLException e){
			e.printStackTrace();
		}
		return srvc;
	}
	
	/**
	 * 
	 * 方法名:   createCustomerInfo   
	 * 方法描述: 注册公司客户
	 * 传入参数:  
	 * 返回值类型: CustomInfoDTO
	 * 异常对象:
	 */
	public static CustomInfoDTO createCustomerInfo(CustomInfoDTO CustomInfoDTO){
		return getSrvc().createCustomerInfo(CustomInfoDTO);
	}
	
	/**
	 * 
	 * 方法名:   validateCompanyName   
	 * 方法描述: 检查公司名是否重复
	 * 传入参数:  
	 * 返回值类型: Boolean
	 * 异常对象:
	 */
	public static Boolean validateCompanyName(String companyName){
		return getSrvc().validateCompanyName(companyName);
	}

	/**
	 * 
	 * 方法名:   validateCompanyMail   
	 * 方法描述: 检查公司邮箱是否重复
	 * 传入参数:  
	 * 返回值类型: boolean
	 * 异常对象:
	 */
	public static boolean validateCompanyMail(String mailAddress) {
		return getSrvc().validateCompanyMail(mailAddress);
	}

	/**
	 * 
	 * 方法名:   sendPasswordMail   
	 * 方法描述: 通过邮件获取密码账户信息
	 * 传入参数:  
	 * 返回值类型: boolean
	 * 异常对象:
	 */
	public static boolean sendPasswordMail(String mailAddress) {
		 	return getSrvc().sendPasswordMail(mailAddress);
	}
}

		